import request from "@/axios/request";
import url from "@/axios/url";
const { mesUrl, adminUrl } = url();

// 获取工艺动态属性列表
export function getAttributeList (params = {}) {
  return request({
    url: `${mesUrl}mesCharacteristic/pageWithProp`,
    method: "GET",
    params
  });
}

// 获取工装治具列表
export function getFixtureList (params = {}) {
  return request({
    url: `${adminUrl}commonExtensionFrock/getPageUnScrap`,
    method: "GET",
    params
  });
}

// 获取设备列表
export function getEquipmentList (params = {}) {
  return request({
    url: `${adminUrl}commonBaseEquipmentModeling/getPageGroupByModeling`,
    method: "GET",
    params
  });
}

// 获取工序通用的生产用料配置
export function getProcessMaterialList (params = {}) {
  return request({
    url: `${mesUrl}mesTechnology/getMaterialList`,
    method: "GET",
    params
  });
}

// 新增工艺
export function addTechnology (data = {}) {
  return request({
    url: `${mesUrl}mesTechnology/addAll`,
    method: "POST",
    data
  });
}

// 编辑工艺
export function updateTechnology (data = {}) {
  return request({
    url: `${mesUrl}mesTechnology/updateAll`,
    method: "POST",
    data
  });
}

// 详情
export function rowDetail (id) {
  return request({
    url: `${mesUrl}mesTechnology/info/${id}`,
    method: "GET",
  });
}

// 根据工艺id获取关联工序信息
export function detailList (id) {
  return request({
    url: `${mesUrl}mesTechnologyProcess/detailList/${id}`,
    method: "GET",
  });
}

// 加工顺序，获取工序列表
export function getProcessList (params = {}) {
  return request({
    // url: `${mesUrl}mesProcess/pageTechByCondition`,
    url: `${mesUrl}mesProcess/list`,
    method: "GET",
    params
  });
}

// 查询标准工序分类列表
export function getProcessTypeIdList () {
  return request({
    url: `${mesUrl}mesProcessType/list`,
    method: "GET",
  });
}

// 修改和查看时，获取工艺基本信息
export function getProcessBaseInfo (id) {
  return request({
    url: `${mesUrl}mesTechnology/info/${id}`,
    method: "GET",
  });
}

// 修改和查看时，获取加工顺序列表信息
export function getProcessSequenceList (id) {
  return request({
    url: `${mesUrl}mesTechnology/getDetailList/${id}`,
    method: "GET",
  });
}

// 获取版本列表
export function getHistoryList (data) {
  return request({
    url: `${mesUrl}mesTechnology/historyList`,
    method: "POST",
    data
  });
}

// 校验产品获得系列的工艺版本是否存在
export function checkCodeExist (data) {
  return request({
    url: `${mesUrl}mesTechnology/checkCodeExist`,
    method: "POST",
    data
  });
}

// 加工顺序，获取工序列表
export function getConfigurationItem (params = {}) {
  return request({
    url: `${adminUrl}commonConfigurationItem/list`,
    method: "GET",
    params
  });
}

// 获取车间列表
export function getWorkshopList (params = {}) {
  return request({
    url: `${adminUrl}baseFactoryModeling/children`,
    method: "GET",
    params
  });
}
